<template>
  <dt-modal-edit ref='edit' :title='title' :label-width='130' :width='500' @ok='onOk'>
  </dt-modal-edit>
</template>

<script>
import createPresonOpt from '../opt/createPreson.js'
// import initiateMgr from '@/biz/commission/initiate.js'
import moment from 'moment'
import incentiveMgr from '@/biz/bonus/incentive'
export default {
  data() {
    return {
      info: {
        workNo: '',
        standardMoney: null,
        issuanceRatio: null,
        isReissue: '',
        reissueMonth: '',
        absentWork: 0,
      },
      title: '新增',
    }
  },
  mounted() {},
  methods: {
    create() {
      // this.$refs.edit.show(createPresonOpt.options(this), this.info)
      this.$refs.edit.show(new createPresonOpt(this.info))
    },
    hide() {
      this.$refs.edit.hide()
    },
    onOk() {
      console.log(this.info, 'infof')
      let params = {
        allowanceId: this.$route.query.allowanceId,
        ...this.info,
        // roomId: this.info.roomId,
        // workNo: this.info.workNo,
        // bonusMoney: this.info.bonusMoney,
        // headerId: this.$route.query.headerId,
      }

      // if (this.info.reissueMonth) {
      //   params.reissueMonth = this.info.roomId
      // }
      incentiveMgr.saveBonusAllowanceDetail(params).then((res) => {
        console.log(res, 'sssssssssss')
        if (res) {
          this.$emit('success')
          this.hide()
        }
      })
    },
  },
}
</script>

<style>
</style>
